package com.qf.controller;

import com.qf.entity.TbChoiceQuestion;
import com.qf.service.ChoiceQuestionService;
import com.qf.utils.ResultMsg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 选择题添加和查询最后一条记录
 */
@RestController
@RequestMapping("/choice")
public class ChoiceQuestionController {


    @Autowired
    ChoiceQuestionService choiceQuestionService;


    @PostMapping("/addChoice")
    public ResultMsg addChoice(@RequestBody TbChoiceQuestion tbChoiceQuestion){
        return choiceQuestionService.addChoiceQuestion(tbChoiceQuestion);
    }

    /**
     * 查询最后一条记录,返回题目id
     * @return
     */
    @GetMapping("/findChoiceById")
    public ResultMsg selectChoiceById(){
        return choiceQuestionService.selsctChoiceOne();
    }
}
